package com.inplaceedit.client.ui.contact;

import com.google.gwt.text.shared.AbstractRenderer;
import com.inplaceedit.shared.dto.ContactDto;

public class ContactSexRenderer extends AbstractRenderer<ContactDto.Sex> {
	private static ContactSexRenderer INSTANCE;

	public static ContactSexRenderer get() {
		if (INSTANCE == null) {
			INSTANCE = new ContactSexRenderer();
		}
		return INSTANCE;
	}

	private ContactSexRenderer() {
	}

	@Override
	public String render(final ContactDto.Sex object) {
		String result = "<none selected>";
		if (object != null) {
			switch (object) {
			case MALE:
				result = "Male";
				break;
			case FEMALE:
				result = "Female";
				break;
			case OTHER:
				result = "Other";
				break;
			default:
				result = "Unknown";
				break;
			}
		}
		return result;
	}
}
